<template>
    <view id="reviewRefuse">
        <view class="container">
            <!-- <view class="header">拒绝理由</view> -->
            <textarea class="textarea" placeholder="请填写拒绝理由" v-model="reason"></textarea>
            <button @click="submitFun" class="btn" type="primary" >确定</button>
        </view>
    </view>
</template>
<script>
    import { valCert } from '@/common/api.js'
    export default {
        name: "reviewRefuse",
        data() {
            return {
                reason:'',
                groupid:''
            };
        },
        components: {
        },
        methods: {
            submitFun(){
                if(!this.reason.trim()){
                    uni.showToast({
                        icon: 'none',
                        title: '请输入拒绝理由'
                    })
                    return;
                }
                valCert({
                    group_id:this.groupid,
                    check_state:0,
                    remark:this.reason.trim(),
                }).then((res)=>{
                    const data = res.data;
                    if(data.errcode==0){
                        uni.showModal({
                            title: '提示',
                            content: data.msg,
                            showCancel:false,
                            success: function (res) {
                                if (res.confirm) {
                                    uni.navigateBack({
                                        delta: 2
                                    });
                                }
                            }
                        });
                    }else if(data.errcode==2000){
                        uni.showModal({
                            title: '提示',
                            content: data.msg,
                            showCancel:false,
                            success: function (res) {
                                if (res.confirm) {
                                    uni.navigateBack({
                                        delta: 1
                                    });
                                }
                            }
                        });
                    }else if(data.errcode==1000 || data.errcode==1001){
                        uni.removeStorageSync('token');
                        uni.reLaunch({
                        	url:'/pages/home/welcome'
                        })
                    }else{
                        uni.showToast({
                        	icon: 'none',
                        	title:data.msg
                        });
                    }
                })
            }
        },
        onLoad(options) {
            this.groupid=options.groupid
        }
    };
</script>
<style lang="scss">
    #reviewRefuse {
        position: relative;
        height: 100%;
        // padding: 30rpx;
        .container{
            background: #fff;
            padding: 30rpx;
            display: flex;
            flex-direction: column;
            .header{
                // margin: 20rpx;
                text-align: center;
            }
            .textarea{
                padding: 25rpx;
                border: 1px solid #ddd;
                border-radius: 20rpx;
                width: 100%;
                box-sizing: border-box;
            }
            .btn{
                margin: 30rpx;
                font-size: 32rpx;
                margin-top: 60rpx;
                border-radius: 50rpx;
            }
        }
    }
</style>
